package com.ly.heart.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.ly.common.utils.DateUtils;
import com.ly.common.utils.SecurityUtils;
import com.ly.common.utils.erp.SnowflakeIdWorker;
import com.ly.heart.mapper.KingInvoicePayableProcurePlanMapper;
import com.ly.heart.service.IKingInvoicePayableProcurePlanService;
import org.springframework.stereotype.Service;
import com.ly.heart.domain.KingInvoicePayableProcurePlanEntity;

import javax.annotation.Resource;

/**
 * 金蝶-发票-应付单/采购开票付款计划Service业务层处理
 * @author wutao
 * @date 2024-06-26
 */
@Service
public class KingInvoicePayableProcurePlanServiceImpl extends ServiceImpl<KingInvoicePayableProcurePlanMapper, KingInvoicePayableProcurePlanEntity> implements IKingInvoicePayableProcurePlanService {

    @Resource
    private KingInvoicePayableProcurePlanMapper kingInvoicePayableProcurePlanEntityMapper;

    /**
     * 查询金蝶-发票-应付单/采购开票付款计划
     * @param id 金蝶-发票-应付单/采购开票付款计划ID
     * @return 金蝶-发票-应付单/采购开票付款计划
     */
    @Override
    public KingInvoicePayableProcurePlanEntity selectKingInvoicePayableProcurePlanEntityById (String id) {
        return kingInvoicePayableProcurePlanEntityMapper.selectKingInvoicePayableProcurePlanEntityById ( id );
    }

    /**
     * 查询金蝶-发票-应付单/采购开票付款计划列表
     * @param kingInvoicePayableProcurePlanEntity 金蝶-发票-应付单/采购开票付款计划
     * @return 金蝶-发票-应付单/采购开票付款计划
     */
    @Override
    public List<KingInvoicePayableProcurePlanEntity> selectKingInvoicePayableProcurePlanEntityList (KingInvoicePayableProcurePlanEntity kingInvoicePayableProcurePlanEntity) {
        return kingInvoicePayableProcurePlanEntityMapper.selectKingInvoicePayableProcurePlanEntityList ( kingInvoicePayableProcurePlanEntity );
    }

    /**
     * 新增金蝶-发票-应付单/采购开票付款计划
     * @param kingInvoicePayableProcurePlanEntity 金蝶-发票-应付单/采购开票付款计划
     * @return 结果
     */
    @Override
    public int insertKingInvoicePayableProcurePlanEntity (KingInvoicePayableProcurePlanEntity kingInvoicePayableProcurePlanEntity) {
        kingInvoicePayableProcurePlanEntity.setId ( SnowflakeIdWorker.getInstance ().nextStringId () );
        kingInvoicePayableProcurePlanEntity.setCreateBy ( SecurityUtils.getLoginUser ().getUser ().getUserId () );
        kingInvoicePayableProcurePlanEntity.setCreateTime ( DateUtils.getNowDate () );
        return kingInvoicePayableProcurePlanEntityMapper.insertKingInvoicePayableProcurePlanEntity ( kingInvoicePayableProcurePlanEntity );
    }

    /**
     * 修改金蝶-发票-应付单/采购开票付款计划
     * @param kingInvoicePayableProcurePlanEntity 金蝶-发票-应付单/采购开票付款计划
     * @return 结果
     */
    @Override
    public int updateKingInvoicePayableProcurePlanEntity (KingInvoicePayableProcurePlanEntity kingInvoicePayableProcurePlanEntity) {
        kingInvoicePayableProcurePlanEntity.setUpdateTime ( DateUtils.getNowDate () );
        return kingInvoicePayableProcurePlanEntityMapper.updateKingInvoicePayableProcurePlanEntity ( kingInvoicePayableProcurePlanEntity );
    }

    /**
     * 批量删除金蝶-发票-应付单/采购开票付款计划
     * @param ids 需要删除的金蝶-发票-应付单/采购开票付款计划ID
     * @return 结果
     */
    @Override
    public int deleteKingInvoicePayableProcurePlanEntityByIds (String[] ids) {
        return kingInvoicePayableProcurePlanEntityMapper.deleteKingInvoicePayableProcurePlanEntityByIds ( ids );
    }

    /**
     * 删除金蝶-发票-应付单/采购开票付款计划信息
     * @param id 金蝶-发票-应付单/采购开票付款计划ID
     * @return 结果
     */
    @Override
    public int deleteKingInvoicePayableProcurePlanEntityById (String id) {
        return kingInvoicePayableProcurePlanEntityMapper.deleteKingInvoicePayableProcurePlanEntityById ( id );
    }
}
